package com.ywz.project.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ywz.common.ResultResp;
import com.ywz.project.base.system.entity.TSysLoginLog;
import com.ywz.project.base.system.service.TSysLoginLogService;
import com.ywz.project.system.dto.req.LoginLogPageReq;
import com.ywz.project.system.service.SysLoginLogApiService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class SysLoginLogApiServiceImpl implements SysLoginLogApiService {
    @Resource
    private TSysLoginLogService sysLoginLogService;

    @Override
    public ResultResp getLoginLogPage(LoginLogPageReq req) {
        LambdaQueryWrapper<TSysLoginLog> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(TSysLoginLog::getIsDeleted, 0);
        Page<TSysLoginLog> page = new Page<>(req.getPageNum(), req.getPageSize());
        return ResultResp.success(sysLoginLogService.page(page, queryWrapper));
    }
}
